const mongoose = require("mongoose");
const { Schema } = mongoose;
const goodSchema = new Schema({
    name: {
        type: String,
        required: true,
    },
    price: {
        type: Number,
        required: true
    },
    description: {
        type: String,
        default: ''
    },
    categoryId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'category',
        // required: true,
    },
    tagId: [
      {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'tags'
      } 
    ],
    isCouponAllowed: {
        type: Boolean,
        default: () => true
    },
    images: {
        type: [String],
        default: () => [`noimage.png`]
    },
    updatedAt: {
        type: Number,
        default: Date.now
    },
    disabled: {
        type: Boolean,
        default: false
    },
});
const good = mongoose.model("good", goodSchema);
module.exports =  good